#include <iostream>
#include <vector>
using namespace std;
//单链表解决
//给M个数， 每一个数每次都要找到它的位置，然后插入到开头
typedef struct Node
{
	struct Node *next;
	int val;
	Node(int val,struct Node *next){
		this->val = val;
		this->next = next;
	}
}Node;
int M;
void show(Node *head){  
	Node *cur = head->next;
	while(cur->next!=NULL){
		cout<<cur->val<<" ";
		cur = cur->next;
	}
	cout<<cur->val<<endl;
}
void init(Node * &head){
	head = new Node(0,NULL);
	Node *cur = new Node(1,NULL);
	head->next = cur;
	for(int i=2;i<=10;i++){
		Node *temp = new Node(i,NULL);
		cur->next = temp;
		cur = temp;
	}
}

int main()
{

  cin>>M;
  vector<int> X(M,0);
  for(int i=0;i<M;i++) cin>>X[i];
  Node *head;
 init(head);
 //show(head);
 
  for(int i=0;i<M;i++){
  	Node *fast = head->next,*slow = head;
  	while(fast->val!=X[i]){
  		fast = fast->next;
  		slow = slow->next;
	}
	slow->next = fast->next;
	fast->next = head->next;
	head->next = fast;

	show(head);
  }
  
  
  return 0;
}